package com.seamtop.cuber.es;

import com.seamtop.cuber.common.entriy.TransData;
import com.seamtop.cuber.core.ESManager;
import com.seamtop.cuber.core.ESUtil;
import io.searchbox.client.JestClient;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by feng on 2015/11/4.
 */
public class ESInit {

    public static void main(String [] args){

        try{
            JestClient client = ESManager.getClient();
            List<TransData> transDataList = new ArrayList<TransData>();

            for(int i=0;i<=9;i++){
                TransData transData = new TransData();
                transData.setRowKey("572_15110"+i);
                int x=100 + (int)(Math.random()*300);
                transData.setValue(x+"");
                transData.setFactType(2);
                transDataList.add(transData);
            }
            ESUtil.index(client, transDataList);
        }catch (Exception e){
            e.printStackTrace();
        }
    }


}
